package 练习;

import java.util.Arrays;

public class 求平均值 {
    public static void main(String[] args) {
        double[] array = {1,2,3,4,5};
        double num = ave(array);
        System.out.println(num);
    }
    public static double ave(double[] array){
        double num = 0;
        for (int i = 0; i < array.length; i++) {
            num += array[i];
        }
        return num/array.length;
    }

}